import axios from '../../../controllers/request'
export interface AssistantItemDB {
  create_time: string
  desc: string
  id: string
  logo?: string
  name: string
  update_time: string
  user_id: number
  user_name: string
  status: number
}
/**
 * 提示词列表
 *
 */
export async function callWordList(page = 1, pageSize = 40, name = '', category = '') {
  try {
    const response: { data: any[]; total: number } = await axios.get(
      `/api/v1/prompt_plt/query?page_num=${page}&page_size=${pageSize}&name=${name}&category=${category}`
    )
    return response
  } catch (error) {
    console.error(error)
    throw error
  }
}
/**
 * 搜索类型列表
 */
export const callWordTypeList = async (): Promise<AssistantItemDB[]> => {
  return await axios.get('/api/v1/common/categorylist', {
    params: {}
  })
}

/**
 * 推荐类别列表
 */
export const recommendedList = async (): Promise<AssistantItemDB[]> => {
  return await axios.get('/api/v1/prompt_plt/recommend_cats', {
    params: {}
  })
}

/**
 * 提示词优化
 */
export const optimizeContFun = async (data): Promise<AssistantItemDB[]> => {
  return await axios.post('/api/v1/prompt_plt/optimize', data)
}

/**
 * 新建提示词
 */
export function callWordAdd(data) {
  return axios.post('/api/v1/prompt_plt/create', data)
}

/**
 * 编辑
 */
export function callWordEdit(data) {
  return axios.post('/api/v1/prompt_plt/edit', data)
}

/**
 * 删除提示词
 */
export function callWordDel(data) {
  return axios.post('/api/v1/prompt_plt/delete', data)
}
